// SetupDll.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"

//
// Uninstall_Init
//
// @comm    Called before the application is uninstalled
//
typedef enum
{
	codeUNINSTALL_INIT_CONTINUE = 0,    // @comm Continue with the uninstallation
	codeUNINSTALL_INIT_CANCEL           // @comm Immediately cancel the uninstallation
}
codeUNINSTALL_INIT;

//
// Uninstall_Exit
//
// @comm    Called after the application is uninstalled
//
typedef enum
{
	codeUNINSTALL_EXIT_DONE     = 0     // @comm Exit the uninstallation successfully
}
codeUNINSTALL_EXIT;

//
// Install_Init
//
// @comm    Called before any part of the application is installed
//
typedef enum
{
	codeINSTALL_INIT_CONTINUE  = 0,     // @comm Continue with the installation
	codeINSTALL_INIT_CANCEL             // @comm Immediately cancel the installation
}
codeINSTALL_INIT;

//
// Install_Exit
//
// @comm    Called after the application is installed
//
typedef enum
{
	codeINSTALL_EXIT_DONE       = 0,    // @comm Exit the installation successfully
	codeINSTALL_EXIT_UNINSTALL          // @comm Uninstall the application before exiting the installation
}
codeINSTALL_EXIT;


BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
    return TRUE;
}

codeINSTALL_EXIT Install_Exit(
										HWND    hwndParent,
										LPCTSTR pszInstallDir,      // final install directory
										WORD    cFailedDirs,
										WORD    cFailedFiles,
										WORD    cFailedRegKeys,
										WORD    cFailedRegVals,
										WORD    cFailedShortcuts
										)
{
	if( MessageBox(hwndParent, L"Soft reset needed.\r\nDo you want to soft reset your device now?", L"SMSTasker", MB_YESNO | MB_ICONQUESTION) == IDYES )
	{
		ExitWindowsEx(EWX_REBOOT, 0);
	}

	return codeINSTALL_EXIT_DONE;
}

codeINSTALL_INIT Install_Init(
							  HWND        hwndParent,
							  BOOL        fFirstCall,     // is this the first time this function is being called?
							  BOOL        fPreviouslyInstalled,
							  LPCTSTR     pszInstallDir
							  )
{
	return codeINSTALL_INIT_CONTINUE;
}

codeUNINSTALL_INIT Uninstall_Init(
								  HWND        hwndParent,
								  LPCTSTR     pszInstallDir
								  )
{
	return codeUNINSTALL_INIT_CONTINUE;
}


codeUNINSTALL_EXIT Uninstall_Exit(
	HWND    hwndParent
	)
{
	return codeUNINSTALL_EXIT_DONE;
}